package homework1.exp4;


import homework1.exp2.Student;
import java.util.HashMap;

/**
 * @author fengq
 */
public class HashMapTest1 {
    public static void main(String[] args) {
        Student student1 = new Student("李明", "男");
        Student student2 = new Student("刘丽", "女");

        HashMap<String,Student> students = new HashMap();
        students.put("Jack",student1);
        students.put("Rose",student2);

        System.out.println("已添加"+students.size()+"个学员信息");
        System.out.println("键集："+students.keySet());

        String key="Jack";
        if (students.containsKey(key)){
            Student student = students.get(key);
            System.out.println("英文名为"+key+"的学员姓名："+student.getName());
        }

        String key1="Rose";
        if (students.containsKey(key1)){
            students.remove(key1);
            System.out.println("学员"+key1+"信息已经删除");
        }

        System.out.println("已添加"+students.size()+"个学员信息");
        System.out.println("键集："+students.keySet());
    }
}
